package com.ftg.learn.bus.exam_record.controller;

import com.ftg.learn.bus.exam_record.entity.ExamRecord;
import com.ftg.learn.bus.exam_record.service.ExamRecordService;
import com.ftg.learn.bus.util.ResultType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(value = "审批记录",tags = "审批记录")
public class ExamRecordController {

    @Autowired
    ExamRecordService ers;

    @ApiOperation(value = "审批记录表")
    @GetMapping("/showexamrec")
    public List<ExamRecord> showAll(){
        return ers.showAll();
    }

    @ApiOperation(value = "删单条记录")
    @DeleteMapping("/deletexamrec")
    public int delete(String id){
        return ers.delete(id);
    }

    @ApiOperation(value = "查一条记录")
    @PutMapping("/findonexamrec/{id}")
    public ExamRecord findOne(@ApiParam("审批记录id") @PathVariable String id){
        return ers.findOne(id);
    }

    @GetMapping("/showexamrec/modify&limit/{page}&{limit}&{examrec_id}&{examrec_operater}")
    @ApiOperation("模糊查询与分页")
    public ResultType<ExamRecord> query(@ApiParam("总页数") @PathVariable int page, @ApiParam("每页条数") @PathVariable int limit, @ApiParam("审批记录id") @PathVariable String examrec_id, @ApiParam("操作人") @PathVariable String examrec_operater) {
        return ers.query(page,limit,examrec_id,examrec_operater);
    }
}
